package com.example.mybackend.controller;


import cn.hutool.core.util.StrUtil;
import com.example.mybackend.common.Result;
import com.example.mybackend.entity.administrator;
import com.example.mybackend.service.administratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/")
@CrossOrigin
public class administratorController {
    @Autowired
    private administratorService administratorService;

    @PostMapping("login")
    public Result login(@RequestBody administrator Administrator) {
        if(StrUtil.isBlank(Administrator.getName())||StrUtil.isBlank(Administrator.getPassWord())){
            return Result.error("数据输入不合法");
        }
       Administrator=administratorService.login(Administrator);
        return Result.success(Administrator);
    }

}
